<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page isELIgnored="false"
	import="cz.possoft.explorer.context.*,cz.possoft.explorer.*"%>

<br>
<c:set var="metadata" value="${requestScope.currentMetadata}" />
Operations coming from
<c:choose>
	<c:when test="${currentMetadata.clazz.interface}">
		<c:out value="interface" />
	</c:when>
	<c:otherwise>
		<c:out value="class" />
	</c:otherwise>
</c:choose>
<b> <c:out value="${currentMetadata.clazz.name}" /> </b>
<br>
<br>

<table>
	<tr>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
	</tr>
	<c:forEach var="currentMethodEntry" items="${currentMetadata.methods}">
		<form action="explorer" method="get">
			<c:set var="currentMethodMetadata" value="${currentMethodEntry.value}" /> 
			<input type="hidden" name="methodName" value="${currentMethodMetadata.methodName}" /> 
			<tr>
				<td><c:out value="${currentMethodMetadata.method.returnType.name} " /></td> 
				<td><c:out value="${currentMethodMetadata.methodName}" /> <%int i = 0; %></td>
				<td>
					<c:out value="( " /> 
					<c:forEach var="paramm" items="${currentMethodMetadata.paramMetadata}">
						<% i = i + 1; %>
						<c:out value="${paramm.paramType.name}" />
						
						<c:choose>
							<c:when test="${paramm.convertable}">
								<c:set var="convertableString" value="" />
							</c:when>
							<c:otherwise>
								<c:set var="convertableString" value=" disabled='disabled' " />
							</c:otherwise>
						</c:choose>												
						<input type="name" name="par<%=i%>_${paramm.paramType.name}" ${convertableString} />
						<c:out value=" , " />
					</c:forEach> 
					<c:out value=" )" />
				</td> 
				
				<c:choose>
					<c:when test="${currentMethodMetadata.callable}">
						<c:set var="callableString" value="" />
					</c:when>
					<c:otherwise>
						<c:set var="callableString" value=" disabled='disabled' " />
					</c:otherwise>
				</c:choose>					
				<td><input type="submit" value="Invoke operation" ${callableString} /></td>
			</tr>			
		</form>
	</c:forEach>
</table>

<br>
<hr>